//
// $Id: HelperProperties.java 229567 2008-01-08 14:09:11Z ravij $
//
// Copyright (1997-2007),Fair Isaac Corporation. All Rights Reserved.
//

package com.nipun.neural.utils;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;

/**
 * <p>
 * Retrieves properties from helper.properties.
 * </p>
 */
public class PropertiesManager
{
	/**
	 * <p>
	 * loaded properties file
	 * </p>
	 */
	private Properties _properties;

	/**
	 * <p>
	 * object for aynch block
	 * </p>
	 */
	private static Object _obj = new Object();

	/**
	 * <p>
	 * properties instance
	 * </p>
	 */
	private static PropertiesManager _managerInstance;

	/**
	 * 
	 */
	private PropertiesManager()
	{
		try {
			_properties = new Properties();
			_properties.load(this.getClass().getResourceAsStream("utils.properties"));
//			_properties.load(new FileInputStream(new File("utils.properties")));
		}
		catch (IOException ioe) {
			ioe.printStackTrace();
		}
	}

	/**
	 * <p>
	 * get singleton instance
	 * </p>
	 */
	public static PropertiesManager getInstance()
	{
		synchronized (_obj) {
			if (_managerInstance == null) {
				_managerInstance = new PropertiesManager();
			}
		}
		return _managerInstance;
	}

	/**
	 * @return
	 */
	public Properties getProperties()
	{
		return _properties;
	}

}
